<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateShopRecords extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('shop_records', function (Blueprint $table) {
            $table->id();

            $table->unsignedInteger('shopId')->default(0)->comment('门店ID');
            $table->unsignedInteger('shopCode')->default(0)->comment('门店code');
            $table->unsignedInteger('staffCount')->default(0)->comment('员工数');
            $table->unsignedInteger('inShopStaffCount')->default(0)->comment('到店员工数');
            $table->unsignedInteger('cardAbnormalCount')->default(0)->comment('证件缺失/异常');
            $table->unsignedInteger('approvedCount')->default(0)->comment('通过审核人数');
            $table->unsignedInteger('rejectCount')->default(0)->comment('驳回人数');
            $table->unsignedInteger('pendingCount')->default(0)->comment('待审核人数');

            $table->unsignedInteger('lastManagerUpdateTime')->default(0)->comment('商家更新时间');
            $table->unsignedInteger('lastAuditTime')->default(0)->comment('最近审核时间');

            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('更新人');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');

            $table->index('shopId', 'idx_shopId');
            $table->index('shopCode', 'idx_shopCode');
            $table->comment   = '门店备案-门店列表';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('shop_records');
    }
}
